package com.cn.mmd.service;

import com.cn.mmd.mapper.*;
import com.cn.mmd.model.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 对教师评价接口的实现类
 * Created by Administrator on 2016/7/8.
 */

@Service("EvaluateTeacher")

public class EvaluateTeacherServiceImpl implements EvaluateTeacherService {

    @Autowired
    protected StudentEvaluateMapper studentEvaluateMapper;
    @Autowired
    protected TeacherRankingMapper teacherRankingMapper;
    @Autowired
    protected LabelMapper labelMapper;
    @Autowired
    protected ColleagueEvaluateMapper colleagueEvaluateMapper;
    @Autowired
    protected SupervisorEvaluateMapper supervisorEvaluateMapper;
    @Autowired
    protected CustomEvaluationMapper customEvaluationMapper;
    @Autowired
    protected TeachingGroupMapper teachingGroupMapper;
    @Autowired
    protected LabelIndexMapper labelIndexMapper;
    @Autowired
    protected LabelTwoIndexMapper labelTwoIndexMapper;
    @Autowired
    protected LabelThreeIndexMapper labelThreeIndexMapper;
    @Autowired
    protected TermBeginsTimeMapper termBeginsTimeMapper;


    /**
     * 在排名表中查出所有分数
     * @param teacherId
     * @return
     */
    public TeacherRanking selecteMyAvg(String teacherId){
        TeacherRanking teacherRanking = teacherRankingMapper.selectByPrimaryKey(teacherId);
        return teacherRanking;
    }


    /**
     * 查出学生对该老师评价的所有标签
     * @param teacherId
     * @return
     */
    public List<StudentEvaluate> selectStudentLabel(String teacherId){

        List<StudentEvaluate> list= studentEvaluateMapper.selectStudentLabel(teacherId);

        return list;
    }


    /**
     * 查出标签库里所有标签
     * @return
     */
    public Label selectAllLabel(Label label){

        return labelMapper.selectAllLabel(label);
    }


    /**
     * 查出同事对该老师评价的所有标签
     * @param teacherId
     * @return
     */
    public List<ColleagueEvaluate> selectColleagueLabel(String teacherId){

        return colleagueEvaluateMapper.selectColleagueLabel(teacherId);
    }


    /**
     * 查出督导对该老师评价的所有标签
     * @param teacherId
     * @return
     */
    public List<SupervisorEvaluate> selectSupervisorLabel(String teacherId){

        return supervisorEvaluateMapper.selectSupervisorLabel(teacherId);
    }


    /**
     * 查出所有对我的自定义评价
     * @param customEvaluation
     * @return
     */
    public List<CustomEvaluation> selectAllCustomEvaluation(CustomEvaluation customEvaluation){

        return customEvaluationMapper.selectAllCustomEvaluation(customEvaluation);
    }


    /**
     * 查出自己所在小组的id
     * @return
     */
    public List<TeachingGroup> selectTeachingGroupId(String teacherId){
        List<TeachingGroup> list=teachingGroupMapper.selectTeacherGroupId(teacherId);
        return list;
    }


    /**
     * 通过小组id查出小组中其他老师
     * @param
     * @return
     */
    public List<TeachingGroup> selectSameGroup(TeachingGroup teachingGroup){

        return teachingGroupMapper.selectSameGroup(teachingGroup);
    }


    /**
     * 对同事标签评价
     * @param colleagueEvaluate
     * @return
     */
    public int insertColleagueEvaluation(ColleagueEvaluate colleagueEvaluate){

        return colleagueEvaluateMapper.insertSelective(colleagueEvaluate);
    }


    /**
     * 对同行自定义评价
     * @param customEvaluation
     * @return
     */
    public int insertcustomEvaluation(CustomEvaluation customEvaluation){

        return customEvaluationMapper.insertSelective(customEvaluation);
    }

    /**
     * 查看一级指标权重
     * @param labelIndex
     * @return
     */
    public LabelIndex selectIndex(LabelIndex labelIndex){

        return labelIndexMapper.selectIndex(labelIndex);
    }


    /**
     * 查出所有老师分数
     * @return
     */
    public List<TeacherRanking> selectAllAvg(){
        return teacherRankingMapper.selectAllAvg();
    }



    /**
     * 通过二级指标名查出其权重
     * @return
     */
    public LabelTwoIndex selectByTwoIndexName(LabelTwoIndex labelTwoIndex){
        return labelTwoIndexMapper.selectByTwoIndexName(labelTwoIndex);
    }

    /**
     * 通过标签库名和三级指标名查出其权重
     * @return
     */
    public LabelThreeIndex selectByThreeIndexName(LabelThreeIndex labelThreeIndex){
        return labelThreeIndexMapper.selectByThreeIndexName(labelThreeIndex);
    }


    /**
     * 督导标签评价
     * @param supervisorEvaluate
     * @returns
     */
    public int insertSupervisorEvaluation(SupervisorEvaluate supervisorEvaluate){
        return supervisorEvaluateMapper.insertSelective(supervisorEvaluate);
    }

    /**
     * 查出评价人和被评价人所在的小组
     * @return
     */
    public List<TeachingGroup> selectTeachingGroup(int teachingGroupId){
        return teachingGroupMapper.selectTeacherGroup(teachingGroupId);
    }


    /**
     *学生对老师标签评价
     * @param studentEvaluate
     * @return
     */
    public int insertStudentEvaluation(StudentEvaluate studentEvaluate){
        return studentEvaluateMapper.insertSelective(studentEvaluate);
    }


    /**
     * 查出自定义评价数量
     * @return
     */
    public int countCustomEvaluation(String teacherId){
        return customEvaluationMapper.countCustomEvaluation(teacherId);
    }


    /**
     * 通过专业查出学生评价数量
     * @return
     */
    public int countStudentEvaluateByMajor(StudentEvaluate studentEvaluate){
        return studentEvaluateMapper.countStudentEvaluateByMajor(studentEvaluate);
    }


    /**
     * 查开学时间
     * @return
     */
    public TermBeginsTime selectTermBeginsTime(){
        return termBeginsTimeMapper.selectTermBeginsTime();
    }
}
